﻿

#region Using Statements

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Xml;
using System.Xml.Serialization;
using System.Threading;
using System.ComponentModel;
using System.Reflection;

using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Design;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using Microsoft.Xna.Framework.Net;
using Microsoft.Xna.Framework.Storage;

using Freeform;
using FGame = Freeform.Game;
using XGame = Microsoft.Xna.Framework.Game;

#endregion


namespace Freeform
{
    /// <summary>
    /// The Random class wraps the System.Random number generator and provides extra functionality.
    /// </summary>
    public class Random
    {

        #region Members

        /// <summary>
        /// Gets the System.Random used under the hood by this class.
        /// </summary>
        public System.Random Base { get; private set; }

        #endregion


        #region Init

        /// <summary>
        /// Creates a new random number generator.
        /// </summary>
        internal Random()
        {
            Base = new System.Random();
        }

        #endregion


        #region Utility

        /// <summary>
        /// Generates a random floating-point precision value between the given bounds.
        /// </summary>
        /// <param name="LowerBound">The lower bound on the value.</param>
        /// <param name="UpperBound">The upper bound on the value.</param>
        /// <returns>A random number.</returns>
        public Single Single(Single LowerBound, Single UpperBound)
        {
            return (Single)(Base.NextDouble() * (UpperBound - LowerBound) + LowerBound);
        }


        /// <summary>
        /// Generates a random double floating-point precision value between the given bounds.
        /// </summary>
        /// <param name="LowerBound">The lower bound on the value.</param>
        /// <param name="UpperBound">The upper bound on the value.</param>
        /// <returns>A random number.</returns>
        public Double Double(Double LowerBound, Double UpperBound)
        {
            return Base.NextDouble() * (UpperBound - LowerBound) + LowerBound;
        }


        /// <summary>
        /// Generates a random integer between the given bounds.
        /// </summary>
        /// <param name="LowerBound">The lower bound on the value. (Inclusive)</param>
        /// <param name="UpperBound">The upper bound on the value. (Inclusive)</param>
        /// <returns>A random number.</returns>
        public Int32 Int32(Int32 LowerBound, Int32 UpperBound)
        {
            return Base.Next(LowerBound, UpperBound - 1);
        }

        #endregion

    }
}
